export type ILayouts = 'inline' | 'horizontal' | 'vertical';
import {ReactNode} from 'react';
// inline 紧贴
// horizontal 水平两边
// vertical 垂直分布
export const layouts: { [key in ILayouts]: ILayouts } = {
  inline: 'inline',
  horizontal: 'horizontal',
  vertical: 'vertical'
}



export type IControlType = 'Input' | 'InputNumber' | 'Radio' | 'RadioGroup' | 'Checkbox' | 'AutoComplete' | 'Select'
  | 'Cascader' | 'DatePicker' | 'Slider' | 'Switch' | 'TimePicker' | 'Upload' | 'ColorPicker' | 'Tag' | 'TextArea'
  | 'UploadImage';

export const EnumControlType: { [key in IControlType]: IControlType } = {
  Input: 'Input',
  TextArea: 'TextArea',
  InputNumber: 'InputNumber',
  Radio: 'Radio',
  RadioGroup: 'RadioGroup',
  Checkbox: 'Checkbox',
  AutoComplete: 'AutoComplete',
  Select: 'Select',
  Cascader: 'Cascader',
  DatePicker: 'DatePicker',
  Slider: 'Slider',
  Switch: 'Switch',
  TimePicker: 'TimePicker',
  Upload: 'Upload',
  ColorPicker: 'ColorPicker',
  Tag: 'Tag',
  UploadImage: 'UploadImage',
}

export type ITypes = 'label' | 'formItem' | 'formItemWrapper' | 'divider' | 'group' | 'wrapper';
export const wrapperType: { [key in ITypes]: ITypes } = {
  label: 'label',
  formItem: 'formItem',
  formItemWrapper: 'formItemWrapper',
  divider: 'divider',
  group: 'group',
  wrapper: 'wrapper',
}

import {FormItemProps} from 'antd/lib/form';
export interface ITabsFields {
  name?: string,
  label?: string | ReactNode,
  type?: ITypes,
  propType?: string,
  defaultValue?: string | number,
  controlType?: string,
  formItemProps?: FormItemProps,
  controlProps?: any,
  layout?: ILayouts,
  helper?: any,
  extra?: any,
  col?: number,
  data?: Array<SelectData | RadioGroupData>,
  groupFields?:  ITabsFields[],
  wrapper?(children?: ReactNode): ReactNode
}

export interface IFields extends ITabsFields{

}

export interface ITabPanel {
  closable?: boolean;
  title?: string;
  value?: string;
  fields?: ITabsFields[];
}

export interface SelectData {
  label: string,
  value: string | number,
  [key: string]: string | number
}

export interface RadioGroupData {
  label: string,
  value: string | number,
  [key: string]: string | number
}
